package com.ant.storage.service.impl;

import com.ant.storage.dto.PlatformDto;
import com.ant.storage.mapper.PlatformMsgMapper;
import com.ant.storage.pojo.PlatformMsg;
import com.ant.storage.service.IPlatformMsgService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hzd
 * @since 2023-07-24
 */
@Service
public class PlatformMsgServiceImpl extends ServiceImpl<PlatformMsgMapper, PlatformMsg> implements IPlatformMsgService {

    @Override
    public PageInfo<PlatformMsg> queryAllByPage(PlatformDto dto) {
            PageHelper.startPage(dto.getPageIndex(),dto.getPageSize());
            QueryWrapper<PlatformMsg> wrapper=new QueryWrapper<>();
            if(StringUtils.isNotEmpty(dto.getName())){
                wrapper.like("platform_name",dto.getName());
            }
            wrapper.eq("is_del",1);
            wrapper.orderByDesc("id");
            List<PlatformMsg> list=this.baseMapper.selectList(wrapper);
            PageInfo<PlatformMsg> pageInfo=new PageInfo<>(list);
            return pageInfo;
    }
}
